#ifndef _TRANSFROMCOMP_H_
#define _TRANSFROMCOMP_H_

#include <SECore/Ecs/Component.h>
#include <glm/glm.hpp>
#include <SECore/Reflect.h>
// #include <SEngine/Ecs/TypeRegister.h>
#include <glm/gtc/quaternion.hpp>

namespace SEngine
{
    struct TransformComp : public Component<TransformComp> 
    {
        ENABLE_SERIALIZE(Component<TransformComp>)

        TransformComp(Actor & actor) : Component(actor) {}
        virtual ~TransformComp() = default;
        void Attach() override;
        void OnUpdate(int delta) override;
        glm::mat4 GetModel();
        glm::mat4 GetLocalModel();
        glm::mat4 GetTranslateMatrix();
        glm::mat4 GetScaleMatrix();
        glm::mat4 GetRotateMatrix();
        glm::mat4 GetTranslateRotateMatrix();
        glm::mat4 ToLocalModel(glm::mat4 m);
        void SetModel(glm::mat4 matrix);
        void SetLocalModel(glm::mat4 matrix);
        // glm::mat4 ToModel(glm::mat4 m);

        glm::vec3 translate{0.0f};
        glm::vec3 scale{1.0f};
        glm::quat rotate{glm::vec3{0.0f}};
    };

    REF_REGISTER_CLASS(TransformComp, 
        REF_REGISTER_FIELD(TransformComp, translate),
        REF_REGISTER_FIELD(TransformComp, scale),
        REF_REGISTER_FIELD(TransformComp, rotate),
        REF_REGISTER_FUNC(TransformComp, GetModel),
        REF_REGISTER_FUNC(TransformComp, GetLocalModel)
    )

} // namespace SEngine


#endif